package org.robot.dao;

import org.robot.pojo.Journal;
import org.robot.utils.StrUtils;

public class JournalDao extends BaseDao {

    public static boolean addJournal(Journal journal) {
        try {
            journal.setInsertTime(StrUtils.getCurrentDateTime());
            journal.setStatus(1L);
            Long pid = selectPidByWebsite(Journal.class, journal.getWebsite(), journal.getTaskId());
            if (pid == null)
            	return save(journal) > 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
    
    
    public static void main(String[] args) {
        Journal journal = new Journal();
        journal.setJournalname("首都体育学院学报");
        journal.setIssn("1009-783X");
        journal.setWebsite("http://beijitiju.com");
        journal.setTaskId(253L);
        boolean b = addJournal(journal);
        System.out.println(b);
    }
}
